From: Antonio Valentino Date: Tue, 1 Jan 2019 08:46:46 +0000 (+0000) Subject: Comaptibility with numpy 1.16 X-Git-Tag: archive/raspbian/3.10.2-1+rpi1~1^2^2^2^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=394bc7153b9d04390fd80aa9d99b415615cabdea;p=pytables.git Comaptibility with numpy 1.16 * fix not writeable buffers * better handling of exception types Gbp-Pq: Name 0005-Comaptibility-with-numpy-1.16.patch --- diff --git a/tables/hdf5extension.pyx b/tables/hdf5extension.pyx index 6dc32f4..e64d1a1 100644 --- a/tables/hdf5extension.pyx +++ b/tables/hdf5extension.pyx @@ -111,6 +111,9 @@ from utilsextension cimport malloc_dims, get_native_type, cstr_to_pystr, load_re #------------------------------------------------------------------- +cdef extern from "Python.h": + + object PyByteArray_FromStringAndSize(char *s, Py_ssize_t len) # Functions from HDF5 ARRAY (this is not part of HDF5 HL; it's private) cdef extern from "H5ARRAY.h" nogil: @@ -2141,8 +2144,8 @@ cdef class VLArray(Leaf): # Create a buffer to keep this info. It is important to do a # copy, because we will dispose the buffer memory later on by # calling the H5Dvlen_reclaim. PyBytes_FromStringAndSize does this. - buf = PyBytes_FromStringAndSize(rdata[i].p, - vllen*self._atomicsize) + buf = PyByteArray_FromStringAndSize(rdata[i].p, + vllen*self._atomicsize) else: # Case where there is info with zero lentgh buf = None diff --git a/tables/tests/test_array.py b/tables/tests/test_array.py index b7d6a3f..563c766 100644 --- a/tables/tests/test_array.py +++ b/tables/tests/test_array.py @@ -2005,7 +2005,7 @@ class NonHomogeneousTestCase(common.TempFileMixin, TestCase): """Test for creation of non-homogeneous arrays.""" # This checks ticket #12. - self.assertRaises(ValueError, + self.assertRaises((ValueError, TypeError), self.h5file.create_array, '/', 'test', [1, [2, 3]]) self.assertRaises(NoSuchNodeError, self.h5file.remove_node, '/test') diff --git a/tables/tests/test_lists.py b/tables/tests/test_lists.py index 9cf83fe..9e79130 100644 --- a/tables/tests/test_lists.py +++ b/tables/tests/test_lists.py @@ -144,14 +144,14 @@ class ExceptionTestCase(TestCase): print('\n', '-=' * 30) print("Running test for %s" % (self.title)) a = self.charList - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TypeError)): WriteRead(self.h5fname, a) def test01_types(self): """Non supported lists object (numerical types)""" a = self.numericalList - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TypeError)): WriteRead(self.h5fname, a)